combinatorics math probabilities *1600

Please click on ads to support us..

C++ Code:

// Problem: C. Little Pony and Expected Maximum
// Contest: Codeforces - Codeforces Round 259 (Div. 2)
// URL: https://codeforces.com/contest/454/problem/C#
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#define rep1(i, j, n) for (int i(j); i <= n; ++i)
#define rep2(i, j, n) for (int i(j); i >= n; --i)
#define rep(i, n) for (int i(0); i < n; ++i)
#define per(i, n) for (int i(n - 1); ~i; --i)
#define i64 long long
#define ld long double
using namespace std;
signed main(void) {
	ios :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n, m;
	cin >> m >> n;
	ld ans = 0;
	rep1(i, 1, m) {
		ans += i * (powl(1.0 * i / m, 1.0 * n) - powl((i - 1.0) / m, 1.0 * n));
	} cout << setprecision(12) << fixed << ans;
}


Comments

Submit
0 Comments
More Questions

221A - Little Elephant and Function
492C - Vanya and Exams
1369B - AccurateLee
892B - Wrath
999A - Mishka and Contest
727C - Guess the Array
1625C - Road Optimization
1715D - 2+ doors
267A - Subtractions
1582A - Luntik and Concerts
560A - Currency System in Geraldion
946A - Partition
1068B - LCM
1692E - Binary Deque
679A - Bear and Prime 100
488A - Giga Tower
14A - Letter
1150A - Stock Arbitraging
1552A - Subsequence Permutation
1131F - Asya And Kittens
1475F - Unusual Matrix
133B - Unary
1547A - Shortest Path with Obstacle
624A - Save Luke
1238A - Prime Subtraction
1107C - Brutality
1391B - Fix You
988B - Substrings Sort
312A - Whose sentence is it
513A - Game